<%--
  Created by IntelliJ IDEA.
  User: 小文
  Date: 2021/9/3
  Time: 14:36
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html>
<head>
    <title>在线通讯录</title>
</head>
<body>
    <h1>在线通讯录</h1>
    <form method="post" action="${pageContext.request.contextPath}/contact/souList">
        <table>
            <tr>
                <td>
                    查找联系人：<input type="text" name="cname">
                </td>
                <td>
                    <button type="submit">查找</button>
                </td>
                <td>
                    <a href="${pageContext.request.contextPath}/contact/toAdd">添加联系人</a>
                </td>
            </tr>
            <tr>
                <td style="color: red">
                    ${error}
                </td>
            </tr>
        </table>
    </form>
    <table border="1">
        <tr>
            <th>序号</th>
            <th>姓名</th>
            <th>手机</th>
            <th>QQ</th>
            <th>Email</th>
            <th>地址</th>
        </tr>
        <c:forEach var="c" items="${list}">
            <tr>
                <td>${c.id}</td>
                <td><a href="${pageContext.request.contextPath}/contact/selectId?id=${c.id}">${c.cname}</a></td>
                <td>${c.mobile}</td>
                <td>${c.qq}</td>
                <td>${c.email}</td>
                <td>${c.address}</td>
            </tr>
        </c:forEach>
    </table>
    <ul>
        <li>
            <a href="${pageContext.request.contextPath}/contact/list?pageNo=1">首页</a>
            <a href="${pageContext.request.contextPath}/contact/list?pageNo=${pageNo-1}">上一页</a>
            <a href="${pageContext.request.contextPath}/contact/list?pageNo=${pageNo+1}">下一页</a>
            <a href="${pageContext.request.contextPath}/contact/list?pageNo=${totalPageCount}">末页</a>
        </li>
        <li>共${totalCount}条记录&nbsp;&nbsp;${pageNo}/${totalPageCount}页</li>
    </ul>
</body>
</html>
